<?PHP
// vim: set expandtab tabstop=4 shiftwidth=4:
// +----------------------------------------------------------------------+
// | SAPID: XML Sapiens Engine Demonstrator                               |
// +----------------------------------------------------------------------+
// | Author:  Max Baryshnikov aka Mephius <mb@rg.by>	                  |
// | Copyright (c) 2004 Max Baryshnikov                                   |
// | http://sapid.sourceforge.net	                                      |
// +----------------------------------------------------------------------+
// | This source file is free software; you can redistribute it and/or    |
// | modify it under the terms of the GNU Lesser General Public           |
// | License as published by the Free Software Foundation; either         |
// | version 2.1 of the License, or (at your option) any later version.   |
// |                                                                      |
// | This source file is distributed in the hope that it will be useful,  |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    |
// | Lesser General Public License for more details.                      |
// +----------------------------------------------------------------------+
// Release: 28.11.04 (dd/mm/yy)
// $Id: structure.inc.php,v 1.5 2006/02/20 08:27:31 sheiko Exp $

if (!defined("SAPID_STARTED")) die("Hacking attempt!");

$d = dir($root_path . "usr/templates/");
$templates="<select name=\"\" id=\"template\">\n";
while (false !== ($entry = $d->read())) {
	if ($entry!="." and $entry!=".." and preg_match("/\.tpl$/is", $entry)) if(!is_dir($root_path . "usr/templates/" . $entry)) $templates.="<option value=\"".$entry."\">".$entry."</option>\n";
}
$d->close();
$templates.="</select>";
$panel="
<div id=\"menu\" onMouseover=\"highlight(event)\" onMouseout=\"lowlight(event)\" onClick=\"jumpto(event);\" class=\"context_menu\">
<div class=\"item\" url=\"javascript:gettingUp();\">".$lang["MoveUp"]."</div>
<div class=\"item\" url=\"javascript:gettingDown();\">".$lang["MoveDown"]."</div>
<hr />
<div class=\"item\" url=\"javascript:displayform();\">".$lang["AddSubfolder"]."</div>
<div class=\"item\" url=\"javascript:dropTrash();\">".$lang["Delete"]."</div>
<div class=\"item\" url=\"javascript:displayform('current', true);\">".$lang["doc_properties"]."</div>
<hr />
<div class=\"item\" url=\"javascript:view();\">".$lang["Preview"]."</div>
</div>

<div style=\"padding: 20px 20px 0px 20px; font: small Arial, Helvetica, sans-serif; font-size: 12px;\">".$lang["StructureInterfaceDewscription"]."</div>
<script src=\"".$env["http_path"]."usr/system/js/tree.js.php?sid=".session_id()."\" type=\"text/javascript\"></script>
<style>
	td {font-family: Arial; font-size: 11px}
</style>
<form action=\"".$env["http_path"]."?option=structure\" method=\"post\" name=\"tree_form\" id=\"tree_form\">
<div id=\"RESULTS\" style=\"margin: 20px 20px 0px 20px; padding: 8px;  color: #111111; font-weight: bold; font-size: 10px; background-color: #A2C3D8\">Tree status: loading data...</div>
<div style=\"padding: 0px 20px 0px 20px; background-color: #CEE4F2;\" ondragend=\"clearSome();\" onclick=\"hidemenu();\" oncontextmenu=\"return false;\">
<div id=\"xmlTree\" style=\"padding: 8px; background-color: #C2DCED\"></div></div>

<div style=\"margin: 0px 20px 10px 20px; padding: 5px;color: #111111; font-size: 10px; background-color: #A2C3D8\">
<input type=\"button\" id=\"sChanges\" disabled=\"true\" class=\"sapidcms_cont_btn\" value=\"".$lang["savechanges"]."\"
onclick=\"this.disabled=true; document.getElementById('new_xml').value=docobj.xml; document.getElementById('tree_form').submit();\" />
<input type=\"button\" id=\"sInit\" disabled=\"true\" class=\"sapidcms_cont_btn\" value=\"".$lang["cancelchanges"]."\"
onclick=\"init('" . $env["http_path"] . "usr/system/tree.php'); return false;\">
</div>
</form>
<div id=\"some\" style=\"display: block; left: 200px; top: 0px; position: absolute; z-index: 0;\"></div> 
<div class=\"panel\" id=\"panel\" style=\"position: absolute; padding: 0px; margin: 0px; top: 45%; left: 10%; border: 1px solid Gray; background-color: #A2C3D8; display: none; width: 800px; \"  ondragover=\"return false;\">
<div style=\"height: 30px; display: block; position: relative; margin: 0px; margin-right: 20px; padding: 0px;\"><img id=\"header\" src=\"".$env["http_path"]."usr/system/images/x.gif\" width=\"780\" height=\"30\" border=\"0\" ondragstart=\"start_track()\" ondrag=\"window.event.returnValue=track()\" ondragend=\"stop_track();\" /></div>
<table class=\"tpanel\" style=\"margin-top: -28px;\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
<td class=\"header\" nowrap=\"nowrap\"><b id=\"div_title\">".$lang["doc_properties"].":</b></td>
<td class=\"header\" align=\"right\"><img src=\"".$env["http_path"]."usr/system/images/close.gif\" alt=\"Close\" onclick=\"document.getElementById('panel').style.display='none';\" hspace=\"8\" /></td>
</tr>
<tr>
<td nowrap=\"nowrap\">ID:</td><td nowrap=\"nowrap\" style=\"vertical-align: top; font-size: 12px; padding: 5px 20px 0px 20px;\"><div style=\"display: inline\" id=\"docid\">&nbsp;</div></td>
</tr>
<tr>
<td nowrap=\"nowrap\">".$lang["URI"].":</td><td nowrap=\"nowrap\" style=\"vertical-align: top; font-size: 13px; padding-right: 20px;\"><div style=\"display: inline\" id=\"variable\"><span id=\"url\"></span>&nbsp;<input type=\"text\" name=\"var\" id=\"var\" value=\"newpage\" onkeypress=\"return checkvariable('var', event)\"></div>&nbsp;/</td>
</tr>
<tr>
<td nowrap=\"nowrap\">".$lang["Page_title"].":</td><td><input id=\"title\" type=\"text\" name=\"title\" value=\"New Page\"></td>
</tr>
<tr>
	<td nowrap=\"nowrap\">".$lang["Virtual_mask"].":</td>
	<td>

		<input id=\"mask\" type=\"text\" name=\"mask\" style=\"width: 50px;\" />
		<select name=\"select_mask\" style=\"width: 120px\" onchange=\"mask.value=this.value\">
			<option value=\"\">empty</option>
			<option value=\"####\">year mask</option>
			<option value=\"##\">month mask</option>
			<option value=\"##\">day mask</option>
			<option value=\"+\">target entry mask</option>
		</select>

		
	</td>
</tr>
<tr>
<td nowrap=\"nowrap\">".$lang["Template_select"].":</td><td>".$templates."</td>
</tr>
<tr>
<td colspan=2 class=\"header\"><b>".$lang["AccessSettings"]."</b></td>
</tr>
<tr>
<td nowrap=\"nowrap\">".$lang["Owner"].":</td><td><input id=\"owner\" type=\"text\" name=\"owner\"></td>
</tr>
<tr>
<td nowrap=\"nowrap\">".$lang["Group"].":</td><td><input id=\"group\" type=\"text\" name=\"group\"></td>
</tr>
<tr>
	<td nowrap=\"nowrap\" style=\"vertical-align: top; padding-top: 10px;\">".$lang["Permissions"].":</td>
	<td>
		
		<table cellpadding=\"0\" cellspacing=\"0\" style=\"border: none; width: 80%;\">
			<tr>
				<td>&nbsp;</td>
				<td align=\"center\" width=\"40\">".$lang["Owner"]."</td>
				<td align=\"center\" width=\"40\">".$lang["Group"]."</td>
				<td align=\"center\" width=\"40\">".$lang["Others"]."</td>
			</tr>
			<tr>
				<td>".$lang["page.pCreate"]."</td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p11\" type=\"checkbox\" value=\"1\" /></td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p12\" type=\"checkbox\" value=\"1\" /></td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p13\" type=\"checkbox\" value=\"1\" /></td>
			</tr>
			<tr>
				<td>".$lang["page.pWrite"]."</td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p21\" type=\"checkbox\" value=\"1\" /></td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p22\" type=\"checkbox\" value=\"1\" /></td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p23\" type=\"checkbox\" value=\"1\" /></td>
			</tr>
			<tr>
				<td>".$lang["page.pDisplay"]."</td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p31\" type=\"checkbox\" value=\"1\" /></td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p32\" type=\"checkbox\" value=\"1\" /></td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p33\" type=\"checkbox\" value=\"1\" /></td>
			</tr>
			<tr>
				<td>".$lang["page.pRead"]."</td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p41\" type=\"checkbox\" value=\"1\" /></td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p42\" type=\"checkbox\" value=\"1\" /></td>
				<td align=\"center\"><input onClick=\"perms2Int()\" id=\"p43\" type=\"checkbox\" value=\"1\" /></td>
			</tr>
		</table><br />

		<input  id=\"permissions\" type=\"text\" name=\"permissions\" maxlength=\"3\" onKeyUp=\"displayPermissions()\" onkeypress=\"return checkvariable('digit', event)\">
	</td>
</tr>

<tr>
<td colspan=2 class=\"header\"><img src=\"".$env["http_path"]."usr/system/images/en/save_dark.gif\" onclick=\"insertPage();\"/></td>
</tr>
</table>
</div>
<script>

	if(window.addEventListener){
	
		function mozstart(){
			init(\"" . $env["http_path"] . "usr/system/tree.php?rnd=".time()."\");
		}
	
		document.getElementById('header').addEventListener('mousedown', start_track, false);
		window.addEventListener('mouseup', stop_track, false);
		window.addEventListener('load', mozstart, false);
		
	} else document.body.onload=function(){ init(\"" . $env["http_path"] . "usr/system/tree.php?rnd=".time()."\"); };
</script>";
?>

